<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>
    function computed(n,t,i){
     if(n == '' || i == ''){
         alert('参数不完整')
     }
     var aa = 0
    if(t == "+"){
        aa = Number(n) + Number(i)
    }
    if(t == "-"){
        aa = Number(n) - Number(i)
    }
    if(t == "*"){
        aa = Number(n) * Number(i)
    }
    if(t == "/"){
        aa = Number(n) / Number(i)
    }
    console.log(aa);
    }
    var num1 = prompt('数字1')
    var fh = prompt('加减乘除')
    var num2 = prompt('数字2')
    computed(num1,fh,num2)
</script>